package com.itgacl.minio;


import com.itgacl.minio.annotation.EnableMinio;
import com.itgacl.minio.config.MinioConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
@ConditionalOnBean(annotation = EnableMinio.class)
@EnableConfigurationProperties(MinioConfig.class)
public class MinioAutoConfiguration {

    @Autowired
    private MinioConfig minioConfig;

    @Bean
    public MinioService minioService(){
        log.debug("MinioAutoConfiguration init MinioService");
        return new MinioService(minioConfig);
    }
}
